﻿using System;
using PubSub.S3.EventName;

namespace PubSub.S3.Abstract
{
    public abstract class EventDataAbstract
    {
        /// <summary>
        /// 消息ID
        /// </summary>
        public Guid Id { get; set; }
        
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 负载数据
        /// </summary>
        public object Payload { get; set; }

        /// <summary>
        /// 获取事件名称
        /// </summary>
        /// <returns></returns>
        public virtual string GetEventName()
        {
            return EventNameAttribute.GetNameOrDefault(this.GetType());
        }
    }
}